package com.zcr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcr.pojo.Jinhuorecords;
import com.zcr.service.JinhuorecordsService;
import com.zcr.vo.Result;
import org.apache.ibatis.annotations.Lang;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @version 1.0
 * @author： 张诚
 * @date： 2021-03-09 12:20
 */
@Controller
@RequestMapping("/jinhuoxinxi")
public class JinhuorecordsController {

    @Resource
    private JinhuorecordsService jinhuorecordsService;

    @GetMapping("/jinhuojiru")
    public String login(){
        return "jinhuoxinxi";
    }

    @ResponseBody()
    @GetMapping("/pagexinxi")
    public Result getbyjinhuojiru(String drugname, int page, int limit){
        Page<Jinhuorecords> list = jinhuorecordsService.getbyjinhuoxinxi(drugname, page, limit);
        Result result = new Result();
        result.setData(list.getRecords());
        System.out.println(list.getRecords());
        result.setCount(Integer.parseInt(Long.toString(list.getTotal())));
        System.out.println(Integer.parseInt(Long.toString(list.getTotal())));
        return result;
    }

}
